package designPattern.creation5.Singleton.chapter17_singleton.chapter17_5;

public class Champion {
    private static Champion singleton;
    String message;

    private Champion(String message) {
        singleton = this;
        this.message = message;
    }

    //懒汉
    public static synchronized Champion getChampion(String message) {   //这是一个同步方法
        if (singleton == null) {
            singleton = new Champion(message + "是冠军");
        }
        return singleton;
    }

    public static void initChampion() {
        singleton = null;
    }

    public String getMess() {
        return message;
    }
}